package cup.common.utils;

import cn.hutool.core.lang.PatternPool;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;

/**
 * @author : ruoyu
 * @date : 2022/2/28
 */
public class HttpRequestUtil {

	/**
	 * 验证是否为ipv4 格式
	 */
	public static boolean checkIsIPV4(String ip) {
		return PatternPool.IPV4.matcher(ip).matches();
	}

	public static HttpRequest getGet(String url, String xAuthToken) {
		return HttpRequest
			.get(url);
	}


	public static HttpRequest getPost(String url) {
		return HttpRequest
			.post(url)
			.header(Header.CONTENT_TYPE, "application/x-www-form-urlencoded");
	}
}
